-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix add_column and generator behavior for missing type #49
base: main
Are you sure you want to change the base?
Conversation
Without this, ActiveRecord does not yet know which type of adapter to use. This makes monkey patching the specific adapter class(es) that you need impossible. This mirrors what we do in the spec helper.
These were typos in the URLs for comparison links between versions. They should now all work correctly.
When using `add_column`, the definition methods for `ksuid` and `ksuid_binary` are not used like when using `table.ksuid` since `add_column` creates the column directly. This change makes it so any column definition can handle both `ksuid` and `ksuid_binary` correctly by monkey-patching the method that creates the column definitions.
53b1b36
to
14e859c
Compare
@DataDaoDe, care to give this a whirl to see if it fixes the issue? |
@michaelherold awesome. I'll check it out today. |
This fixed the |
This change makes it so `rails generate model example:ksuid` works as expected. I am unsure how fragile this test is. Ideally, we would have a test that runs the generator against a dummy app and asserts on the outcome, but I don't have the spoons to manage that right now.
Rats, I have a fix but it only works for 7.0+. I'd like to still support 6.1 so need to muddle some more. It's almost like monkey-patching Rails is a bad idea! 😅 |
When using
add_column
, the definition methods forksuid
andksuid_binary
are not used like when usingtable.ksuid
sinceadd_column
creates the column directly.This change makes it so any column definition can handle both
ksuid
andksuid_binary
correctly by monkey-patching the method that creates the column definitions.It also makes it so
rails generate model example:ksuid
works as expected. I am unsure how fragile this test is. Ideally, we would have a test that runs the generator against a dummy app and asserts on the outcome, but I don't have the spoons to manage that right now.Closes #48